﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity.ModelConfiguration;
using System.Data.Entity;
using SimpleModel.Model;

namespace SimpleModel.Mapping
{
    public class consumerMap:EntityTypeConfiguration<consumer>
    {
        public consumerMap()
        {
            ToTable("consumer");
            this.HasKey(p => p.id);
            this.Property(p => p.name).IsRequired().HasMaxLength(50);
            this.Property(p => p.user_count).IsRequired().HasMaxLength(50);
            this.Property(p => p.password).IsRequired().HasMaxLength(50);
            this.Property(p => p.phone).HasMaxLength(50);
            this.Property(p => p.email).HasMaxLength(50);
            this.HasIndex("UK_user_count", IndexOptions.Unique, p => p.Property(t => t.user_count));
        }
    }
}
